{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "fPath = './datas/tuiguangyuan.xlsx'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "tuiData = pd.read_excel(fPath,error_bad_lines=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>微信名称</th>\n",
       "      <th>手机号码</th>\n",
       "      <th>来源/加入方式</th>\n",
       "      <th>邀请方</th>\n",
       "      <th>累计成交笔数</th>\n",
       "      <th>累计成交金额</th>\n",
       "      <th>加入时间</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>张君朔</td>\n",
       "      <td>13139051119</td>\n",
       "      <td>H5</td>\n",
       "      <td>魏伟</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>晟道文化～周航</td>\n",
       "      <td>13752990918</td>\n",
       "      <td>H5</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>艾米妮亚服务顾问黄佳</td>\n",
       "      <td>17623367095</td>\n",
       "      <td>H5</td>\n",
       "      <td>黄雪艳</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>王春盛 19905101314</td>\n",
       "      <td>13851085877</td>\n",
       "      <td>H5</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>晟道文化-刘琼</td>\n",
       "      <td>13970942232</td>\n",
       "      <td>H5</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>6</td>\n",
       "      <td>198.4</td>\n",
       "      <td>2020-04-23</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               微信名称         手机号码 来源/加入方式       邀请方  累计成交笔数  累计成交金额        加入时间\n",
       "0               张君朔  13139051119      H5        魏伟       0     0.0  2020-04-23\n",
       "1           晟道文化～周航  13752990918      H5   晟道集团睢小光       0     0.0  2020-04-23\n",
       "2        艾米妮亚服务顾问黄佳  17623367095      H5       黄雪艳       0     0.0  2020-04-23\n",
       "3   王春盛 19905101314  13851085877      H5   晟道集团睢小光       0     0.0  2020-04-23\n",
       "4           晟道文化-刘琼  13970942232      H5   晟道集团睢小光       6   198.4  2020-04-23"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tuiData.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<bound method DataFrame.count of                  微信名称         手机号码 来源/加入方式       邀请方  累计成交笔数  累计成交金额  \\\n",
       "0                 张君朔  13139051119      H5        魏伟       0     0.0   \n",
       "1             晟道文化～周航  13752990918      H5   晟道集团睢小光       0     0.0   \n",
       "2          艾米妮亚服务顾问黄佳  17623367095      H5       黄雪艳       0     0.0   \n",
       "3     王春盛 19905101314  13851085877      H5   晟道集团睢小光       0     0.0   \n",
       "4             晟道文化-刘琼  13970942232      H5   晟道集团睢小光       6   198.4   \n",
       "..                ...          ...     ...       ...     ...     ...   \n",
       "264           晟道文化-丹丹  13637991341      H5         -       0     0.0   \n",
       "265                宋苗  13883612737     小程序         -      27   992.7   \n",
       "266               海茉灿  13983935867     小程序         -      15   399.8   \n",
       "267          晟道文化-尚炎彬  15037979381     小程序         -       3     3.0   \n",
       "268           晟道文化-宋阳  13601921997     小程序         -      14     8.6   \n",
       "\n",
       "           加入时间  \n",
       "0    2020-04-23  \n",
       "1    2020-04-23  \n",
       "2    2020-04-23  \n",
       "3    2020-04-23  \n",
       "4    2020-04-23  \n",
       "..          ...  \n",
       "264  2020-03-05  \n",
       "265  2020-03-05  \n",
       "266  2020-03-05  \n",
       "267  2020-03-05  \n",
       "268  2020-03-04  \n",
       "\n",
       "[269 rows x 7 columns]>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tuiData.count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "namePath = './datas/推广员对应合伙人真实姓名与区域 1.xlsx'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "nameData = pd.read_excel(namePath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>推广员昵称</th>\n",
       "      <th>真实姓名</th>\n",
       "      <th>大区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>美匠婚礼小梅13385274688</td>\n",
       "      <td>刘红梅</td>\n",
       "      <td>三区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>晟道文化～荣珏梒（jué  hán）</td>\n",
       "      <td>荣雪原</td>\n",
       "      <td>四区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>NaN</td>\n",
       "      <td>晟道文化～荣珏梒（jué  hán）</td>\n",
       "      <td>荣雪原</td>\n",
       "      <td>四区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>NaN</td>\n",
       "      <td>宴飨导师-张丽</td>\n",
       "      <td>张丽</td>\n",
       "      <td>三区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>NaN</td>\n",
       "      <td>晟道文化～荣珏梒（jué  hán）</td>\n",
       "      <td>荣雪原</td>\n",
       "      <td>四区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>200</th>\n",
       "      <td>NaN</td>\n",
       "      <td>颜伟</td>\n",
       "      <td>颜伟</td>\n",
       "      <td>二区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>NaN</td>\n",
       "      <td>魏伟</td>\n",
       "      <td>魏伟</td>\n",
       "      <td>总部</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>202</th>\n",
       "      <td>NaN</td>\n",
       "      <td>玺宴宴会酒店徐晓白</td>\n",
       "      <td>徐晓白</td>\n",
       "      <td>二区</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>203 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Unnamed: 0                推广员昵称 真实姓名   大区\n",
       "0           NaN    美匠婚礼小梅13385274688  刘红梅   三区\n",
       "1           NaN                  NaN  NaN  NaN\n",
       "2           NaN                  NaN  NaN  NaN\n",
       "3           NaN   晟道文化～荣珏梒（jué  hán）  荣雪原   四区\n",
       "4           NaN   晟道文化～荣珏梒（jué  hán）  荣雪原   四区\n",
       "..          ...                  ...  ...  ...\n",
       "198         NaN              宴飨导师-张丽   张丽   三区\n",
       "199         NaN   晟道文化～荣珏梒（jué  hán）  荣雪原   四区\n",
       "200         NaN                   颜伟   颜伟   二区\n",
       "201         NaN                   魏伟   魏伟   总部\n",
       "202         NaN            玺宴宴会酒店徐晓白  徐晓白   二区\n",
       "\n",
       "[203 rows x 4 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nameData"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_tuiguang = pd.merge(tuiData,nameData,left_on='微信名称',right_on='推广员昵称',how='left')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>微信名称</th>\n",
       "      <th>手机号码</th>\n",
       "      <th>来源/加入方式</th>\n",
       "      <th>邀请方</th>\n",
       "      <th>累计成交笔数</th>\n",
       "      <th>累计成交金额</th>\n",
       "      <th>加入时间</th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>推广员昵称</th>\n",
       "      <th>真实姓名</th>\n",
       "      <th>大区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>张君朔</td>\n",
       "      <td>13139051119</td>\n",
       "      <td>H5</td>\n",
       "      <td>魏伟</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>晟道文化～周航</td>\n",
       "      <td>13752990918</td>\n",
       "      <td>H5</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>艾米妮亚服务顾问黄佳</td>\n",
       "      <td>17623367095</td>\n",
       "      <td>H5</td>\n",
       "      <td>黄雪艳</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>王春盛 19905101314</td>\n",
       "      <td>13851085877</td>\n",
       "      <td>H5</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>晟道文化-刘琼</td>\n",
       "      <td>13970942232</td>\n",
       "      <td>H5</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>6</td>\n",
       "      <td>198.4</td>\n",
       "      <td>2020-04-23</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>400</th>\n",
       "      <td>晟道文化-丹丹</td>\n",
       "      <td>13637991341</td>\n",
       "      <td>H5</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2020-03-05</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>401</th>\n",
       "      <td>宋苗</td>\n",
       "      <td>13883612737</td>\n",
       "      <td>小程序</td>\n",
       "      <td>-</td>\n",
       "      <td>27</td>\n",
       "      <td>992.7</td>\n",
       "      <td>2020-03-05</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>402</th>\n",
       "      <td>海茉灿</td>\n",
       "      <td>13983935867</td>\n",
       "      <td>小程序</td>\n",
       "      <td>-</td>\n",
       "      <td>15</td>\n",
       "      <td>399.8</td>\n",
       "      <td>2020-03-05</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>403</th>\n",
       "      <td>晟道文化-尚炎彬</td>\n",
       "      <td>15037979381</td>\n",
       "      <td>小程序</td>\n",
       "      <td>-</td>\n",
       "      <td>3</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2020-03-05</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>404</th>\n",
       "      <td>晟道文化-宋阳</td>\n",
       "      <td>13601921997</td>\n",
       "      <td>小程序</td>\n",
       "      <td>-</td>\n",
       "      <td>14</td>\n",
       "      <td>8.6</td>\n",
       "      <td>2020-03-04</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>405 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 微信名称         手机号码 来源/加入方式       邀请方  累计成交笔数  累计成交金额  \\\n",
       "0                 张君朔  13139051119      H5        魏伟       0     0.0   \n",
       "1             晟道文化～周航  13752990918      H5   晟道集团睢小光       0     0.0   \n",
       "2          艾米妮亚服务顾问黄佳  17623367095      H5       黄雪艳       0     0.0   \n",
       "3     王春盛 19905101314  13851085877      H5   晟道集团睢小光       0     0.0   \n",
       "4             晟道文化-刘琼  13970942232      H5   晟道集团睢小光       6   198.4   \n",
       "..                ...          ...     ...       ...     ...     ...   \n",
       "400           晟道文化-丹丹  13637991341      H5         -       0     0.0   \n",
       "401                宋苗  13883612737     小程序         -      27   992.7   \n",
       "402               海茉灿  13983935867     小程序         -      15   399.8   \n",
       "403          晟道文化-尚炎彬  15037979381     小程序         -       3     3.0   \n",
       "404           晟道文化-宋阳  13601921997     小程序         -      14     8.6   \n",
       "\n",
       "           加入时间  Unnamed: 0 推广员昵称 真实姓名   大区  \n",
       "0    2020-04-23         NaN   NaN  NaN  NaN  \n",
       "1    2020-04-23         NaN   NaN  NaN  NaN  \n",
       "2    2020-04-23         NaN   NaN  NaN  NaN  \n",
       "3    2020-04-23         NaN   NaN  NaN  NaN  \n",
       "4    2020-04-23         NaN   NaN  NaN  NaN  \n",
       "..          ...         ...   ...  ...  ...  \n",
       "400  2020-03-05         NaN   NaN  NaN  NaN  \n",
       "401  2020-03-05         NaN   NaN  NaN  NaN  \n",
       "402  2020-03-05         NaN   NaN  NaN  NaN  \n",
       "403  2020-03-05         NaN   NaN  NaN  NaN  \n",
       "404  2020-03-04         NaN   NaN  NaN  NaN  \n",
       "\n",
       "[405 rows x 11 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_tuiguang"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_tuiguang.drop(['加入时间','来源/加入方式','Unnamed: 0'],axis=1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>微信名称</th>\n",
       "      <th>手机号码</th>\n",
       "      <th>邀请方</th>\n",
       "      <th>累计成交笔数</th>\n",
       "      <th>累计成交金额</th>\n",
       "      <th>推广员昵称</th>\n",
       "      <th>真实姓名</th>\n",
       "      <th>大区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>张君朔</td>\n",
       "      <td>13139051119</td>\n",
       "      <td>魏伟</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>晟道文化～周航</td>\n",
       "      <td>13752990918</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>艾米妮亚服务顾问黄佳</td>\n",
       "      <td>17623367095</td>\n",
       "      <td>黄雪艳</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>王春盛 19905101314</td>\n",
       "      <td>13851085877</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>晟道文化-刘琼</td>\n",
       "      <td>13970942232</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>6</td>\n",
       "      <td>198.4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>400</th>\n",
       "      <td>晟道文化-丹丹</td>\n",
       "      <td>13637991341</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>401</th>\n",
       "      <td>宋苗</td>\n",
       "      <td>13883612737</td>\n",
       "      <td>-</td>\n",
       "      <td>27</td>\n",
       "      <td>992.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>402</th>\n",
       "      <td>海茉灿</td>\n",
       "      <td>13983935867</td>\n",
       "      <td>-</td>\n",
       "      <td>15</td>\n",
       "      <td>399.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>403</th>\n",
       "      <td>晟道文化-尚炎彬</td>\n",
       "      <td>15037979381</td>\n",
       "      <td>-</td>\n",
       "      <td>3</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>404</th>\n",
       "      <td>晟道文化-宋阳</td>\n",
       "      <td>13601921997</td>\n",
       "      <td>-</td>\n",
       "      <td>14</td>\n",
       "      <td>8.6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>405 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 微信名称         手机号码       邀请方  累计成交笔数  累计成交金额 推广员昵称 真实姓名   大区\n",
       "0                 张君朔  13139051119        魏伟       0     0.0   NaN  NaN  NaN\n",
       "1             晟道文化～周航  13752990918   晟道集团睢小光       0     0.0   NaN  NaN  NaN\n",
       "2          艾米妮亚服务顾问黄佳  17623367095       黄雪艳       0     0.0   NaN  NaN  NaN\n",
       "3     王春盛 19905101314  13851085877   晟道集团睢小光       0     0.0   NaN  NaN  NaN\n",
       "4             晟道文化-刘琼  13970942232   晟道集团睢小光       6   198.4   NaN  NaN  NaN\n",
       "..                ...          ...       ...     ...     ...   ...  ...  ...\n",
       "400           晟道文化-丹丹  13637991341         -       0     0.0   NaN  NaN  NaN\n",
       "401                宋苗  13883612737         -      27   992.7   NaN  NaN  NaN\n",
       "402               海茉灿  13983935867         -      15   399.8   NaN  NaN  NaN\n",
       "403          晟道文化-尚炎彬  15037979381         -       3     3.0   NaN  NaN  NaN\n",
       "404           晟道文化-宋阳  13601921997         -      14     8.6   NaN  NaN  NaN\n",
       "\n",
       "[405 rows x 8 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_tuiguang"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "duplicate_row = data_tuiguang.duplicated(subset=['微信名称'],keep='first') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      False\n",
       "1      False\n",
       "2      False\n",
       "3      False\n",
       "4      False\n",
       "       ...  \n",
       "400     True\n",
       "401    False\n",
       "402    False\n",
       "403    False\n",
       "404     True\n",
       "Length: 405, dtype: bool"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "duplicate_row"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_bool(x):\n",
    "    if x==True:\n",
    "        return False\n",
    "    return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "juge = duplicate_row.apply(get_bool)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "data=data_tuiguang.loc[ juge,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>微信名称</th>\n",
       "      <th>手机号码</th>\n",
       "      <th>邀请方</th>\n",
       "      <th>累计成交笔数</th>\n",
       "      <th>累计成交金额</th>\n",
       "      <th>推广员昵称</th>\n",
       "      <th>真实姓名</th>\n",
       "      <th>大区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>张君朔</td>\n",
       "      <td>13139051119</td>\n",
       "      <td>魏伟</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>晟道文化～周航</td>\n",
       "      <td>13752990918</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>艾米妮亚服务顾问黄佳</td>\n",
       "      <td>17623367095</td>\n",
       "      <td>黄雪艳</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>王春盛 19905101314</td>\n",
       "      <td>13851085877</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>晟道文化-刘琼</td>\n",
       "      <td>13970942232</td>\n",
       "      <td>晟道集团睢小光</td>\n",
       "      <td>6</td>\n",
       "      <td>198.4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>398</th>\n",
       "      <td>晟道文化-宋阳</td>\n",
       "      <td>13601921997</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>399</th>\n",
       "      <td>晟道文化-丹丹</td>\n",
       "      <td>13637991341</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>401</th>\n",
       "      <td>宋苗</td>\n",
       "      <td>13883612737</td>\n",
       "      <td>-</td>\n",
       "      <td>27</td>\n",
       "      <td>992.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>402</th>\n",
       "      <td>海茉灿</td>\n",
       "      <td>13983935867</td>\n",
       "      <td>-</td>\n",
       "      <td>15</td>\n",
       "      <td>399.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>403</th>\n",
       "      <td>晟道文化-尚炎彬</td>\n",
       "      <td>15037979381</td>\n",
       "      <td>-</td>\n",
       "      <td>3</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>257 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 微信名称         手机号码       邀请方  累计成交笔数  累计成交金额 推广员昵称 真实姓名   大区\n",
       "0                 张君朔  13139051119        魏伟       0     0.0   NaN  NaN  NaN\n",
       "1             晟道文化～周航  13752990918   晟道集团睢小光       0     0.0   NaN  NaN  NaN\n",
       "2          艾米妮亚服务顾问黄佳  17623367095       黄雪艳       0     0.0   NaN  NaN  NaN\n",
       "3     王春盛 19905101314  13851085877   晟道集团睢小光       0     0.0   NaN  NaN  NaN\n",
       "4             晟道文化-刘琼  13970942232   晟道集团睢小光       6   198.4   NaN  NaN  NaN\n",
       "..                ...          ...       ...     ...     ...   ...  ...  ...\n",
       "398           晟道文化-宋阳  13601921997         -       0     0.0   NaN  NaN  NaN\n",
       "399           晟道文化-丹丹  13637991341         -       0     0.0   NaN  NaN  NaN\n",
       "401                宋苗  13883612737         -      27   992.7   NaN  NaN  NaN\n",
       "402               海茉灿  13983935867         -      15   399.8   NaN  NaN  NaN\n",
       "403          晟道文化-尚炎彬  15037979381         -       3     3.0   NaN  NaN  NaN\n",
       "\n",
       "[257 rows x 8 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    " data.to_excel('./datas/name_clean.xlsx',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
